<?php
	session_start();
	include 'conf/conf_'.$_SERVER['HTTP_HOST'].".php";
	header('Content-Type: text/html; charset=utf8');
	include 'classes/Logger.php';
	include 'classes/MysqlConnector.php';
	include 'classes/Description.php';
	
	$mySqlConnector = new MysqlConnector();
	$mySqlConnector->connect();
	$desc = new Description($mySqlConnector);
	$logger = new Logger($mySqlConnector);
	mysql_query("SET NAMES utf8_general_ci");
	mysql_query('SET CHARACTER SET utf8');
	if(isset($_GET['page'])) {
		$logger->log($_GET['page']);
		switch($_GET['page']){
			case 'main':
				include 'tmpl/mainPage.php';
				break;
			case 'custom_tailoring':
				include 'tmpl/custom_tailoring.php';
				break;
			case 'terms_of_rental':
				include 'tmpl/terms_of_rental.php';
				break;
			case 'selling':
				include 'tmpl/selling_page.php';
				break;
			case 'news':
				include 'tmpl/news.php';
				break;
			case 'stock':
				include 'tmpl/stock.php';
				break;
			case 'contacts':
				include 'tmpl/contacts.php';
				break;
			default:
				print "uncknow page";
				include 'tmpl/'.$_GET['page'].'.php';
				break;
		}
	} else if(isset($_GET['query'])){
		$logger->log('query');
		include 'queries/execute.php';
	}
	$mySqlConnector->disconnect();
?>